// vite6.x 引入当前目录下所有组件
const componentFiles = import.meta.glob("./*.vue");

export async function registerGlobalComponents(app) {
  for (const fileName of Object.keys(componentFiles)) {
    const componentName = `G${fileName
      .split("/")
      .pop()
      .replace(/\.vue$/, "")}`;
    const componentModule = await componentFiles[fileName]();
    app.component(componentName, componentModule.default);
  }
}
